package com.hzhr.iot.device.service.helper;

import com.hzhr.iot.core.exception.ServiceException;
import com.hzhr.iot.user.sdk.model.company.CompanyModel;
import com.hzhr.iot.user.sdk.service.User_CompanyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.HashMap;
import java.util.Map;

@Component
public class User_CompanyServiceHelper {
    @Autowired
    User_CompanyService user_companyService;

    public CompanyModel getById(Map<String, String> header, int companyId)
            throws ServiceException {
        Map<String, Object> query = new HashMap<>();
        query.put("_equal_id", companyId);
        query.put("_show", "one");
        query.put("_show_info", true);

        CompanyModel companyModel = user_companyService.get(header, query).getModel();
        return companyModel;
    }
}
